﻿using System;
using fit;

namespace ScrumBox.AcceptanceTests.HelloWorld
{
    public class User
    {
        private static readonly User[] hhgg = new[]
                                                  {
                                                      new User(1, "Arthur Dent", "adent"),
                                                      new User(2, "Ford Prefect", "fprefect"),
                                                      new User(3, "Zaphod Beeblebrox", "beeble")
                                                  };

        private static readonly User[] jedi = new[]
                                                  {
                                                      new User(1, "Obi-Wan Kenobi", "kenobi"),
                                                      new User(2, "Qui-Gon Jinn", "quigonn"),
                                                      new User(3, "Mace Windu", "windu")
                                                  };

        public int id;
        public String name;
        public String username;

        private User(int id, String name, String username)
        {
            this.id = id;
            this.name = name;
            this.username = username;
        }

        public static User[] GetList(String list)
        {
            return "jedi".Equals(list) ? jedi : hhgg;
        }

        public static User[] GetList()
        {
            return hhgg;
        }
    }

    public class ListActiveUsersWithParam : RowFixture
    {
        public override Type GetTargetClass()
        {
            return typeof (User);
        }

        public override object[] Query()
        {
            return User.GetList(Args[0]);
        }
    }

    public class ListActiveUsers : RowFixture
    {
        public override object[] Query()
        {
            return User.GetList();
        }

        public override Type GetTargetClass()
        {
            return typeof (User);
        }
    }
}